home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 2 / CU Amiga Magazine's Super CD-ROM 02 (1996)(EMAP Images)(GB)[!][issue 1996-04].iso / magazine / amiga_e / amigae.july.archive / 000034_crash!mars.let.uva.nl!wouter_Fri, 16 Jul 93 15:51:34 PST.msg < prev    next >
Text File  |  1993-08-31  |  6KB  |  132 lines

  1. Received: by bkhouse.cts.com (V1.16/Amiga)
  2.     id AA00000; Fri, 16 Jul 93 15:51:34 PST
  3. Received: from mars.let.uva.nl by crash.cts.com with smtp
  4.     (Smail3.1.28.1 #15) id m0oGxkR-0000A0C; Fri, 16 Jul 93 14:55 PDT
  5. Received: by mars.let.uva.nl id AA16092
  6.   (5.65c/IDA-1.4.4 for amigae@bkhouse.cts.com); Fri, 16 Jul 1993 23:58:58 +0200
  7. Return-Path: <wouter@mars.let.uva.nl>
  8. Date: Fri, 16 Jul 1993 23:58:58 +0200
  9. Message-Id: <199307162158.AA16092@mars.let.uva.nl>
  10. X-Organisation: Department of Computational Linguistics,
  11.                 University of Amsterdam
  12.                 Spuistraat 134, 1012 VB Amsterdam, The Netherlands
  13. From: Wouter van Oortmerssen <wouter@mars.let.uva.nl>
  14. To: amigae@bkhouse.cts.com
  15. Subject: Optimizing E
  16.  
  17. >> Boyerm.e probably suffered from a low buffer size input, which reminds me,
  18. >> what are the proper arguments for the DOS function SetVBuf()? The DOS
  19. >> manual says it accepts 4 arguments, E only accepts 3!?
  20.  
  21. SetVBuf() is broken in 2.1b. If you really need to use this function,
  22. the only thing you can do is write an assembly stub for this yourself
  23.  
  24. >> Okay, so the boyerm.e example wasn't a very good as it relied on DOS calls,
  25. >> but I still say E is slower and would benefit from a good optimizer. While
  26. >> I was debugging my programs, I noticed that E always(?) used MOVE.L x(A5),D0
  27. >> for variable storage/retrieval. In a tight loop, a MOVE.L x(AN),D0
  28. >> will cost more cycle time than a MOVE.L D1,D0. Since E doesn't touch the
  29. >> other data registers often, it would help speed time greatly if you could
  30. >> use them.
  31.  
  32. already very early in the design stage of the E compiler, I had to make
  33. a choice: do I give the registers to the language, or do I make them
  34. free for use with inline assembly? back then, I was just making the perfect
  35. language for just one person (me), and since I enjoy using assembly
  36. very much, I chose for the latter. The consequence is that the compiler
  37. _may_ thrash registers with every expression, and the fact that they
  38. don't most of of the time is no guarantee for the compiler that it can
  39. put it's variables there.
  40.  
  41. >> For a better example(?) I coded the following short |ittle program, which is
  42. >> small and relies on no external calls (except for outputting of result at
  43. >> the end which btw, if left out under SAS/C, makes the program run under
  44. >> 1 sec - clever optimiser :)
  45.  
  46. yeah, but you give it something any optimizer could get away with. Try
  47. again with a more complex (real-life) algorithm with more variables in certain
  48. parts than registers, consisting of multiple functions (i.e. own written
  49. functions, not buitins etc.), and the gains made from the optimizer will
  50. drop down tremendously.
  51.  
  52. >> Although I don't expect E to outperform a commercial C product, using
  53. >> spare data registers would increase E's performance tremendously.
  54.  
  55. agreed. SAS/C can outperform E 2.1b when it wants to, in most situations.
  56. the problems due to the nature of compiler and language regarding
  57. allocating registers and such, will not stop me from gradually enhancing
  58. EC with capabilities that allow great optimisations in code. some
  59. of you will probably notice that v2.5 will already be a great step
  60. forward, and it will continue to be enhanced to generate even better
  61. code, making good use of registers (which will cause performance
  62. tradeoffs with inline assembly, but nothing serious).
  63.  
  64. >> One last suggestion.. how about making some E functions (such as WriteF)
  65. >> more assembling friendly, so you can use certain E functions in the middle
  66. >> of an assembly code? ie. it uses only the upper data/address registers (4-7)
  67. >> and leaves the lower ones intact.
  68.  
  69. it would be very future-incompatible to guarantee certain registers
  70. preserved by certain E language constructs.
  71. I of course simply could have saved all registers at any swap
  72. between E and Asm, but this would have been unnecessary overhead.
  73. most inline assembly parts simply take a few values, do some
  74. heavy computing, and shove the result in an E variable, and thus
  75. won't need to save _any_ registers. that's why you have to do
  76. it yourself. a better programming style if you want to mix E
  77. and Asm all the time, is to keep all long term values that
  78. have to be preserved in E variables, and use registers for
  79. all other variables that "live" only within one block of
  80. assembly.
  81.  
  82. >> Regards..
  83. >> Son Le
  84. >> 
  85. >> PS. Wouter, your address <Wouter@alf.let.uva.nl> bounced.
  86.  
  87. oh? are you the only one having trouble with this? I still receive
  88. plenty of mail there.
  89.  
  90. >> > >what are the proper arguments for the DOS function SetVBuf()? The DOS
  91. >> > >manual says it accepts 4 arguments, E only accepts 3!?
  92. >> > 
  93. >> > I remember you asking this before.  Don't know, so I didn't answer.
  94. >> 
  95. >> I was hoping Wouter could answer this for me. He properly missed the last one
  96.  
  97.  
  98. I did miss it. I was on a short vacation.
  99.  
  100. >> > I recall Wouter saying that ++ returns a value and eats up some ticks in th
  101.  
  102. >> > process.  That may be what's going on in that Asm instruction you questione
  103. ,
  104. >> > the value is being returned in D0.  The C compiler sees that you're not doi
  105. g
  106. >> > anything with the returned value, so optimizes it away.
  107.  
  108. that's exactly what happens. E v2.5 too takes care of this.
  109.  
  110. >> >Did Wouter say that the new version can output debug symbols?
  111. >> 
  112. >> I don't recall mention of it.  But now would be a good opportunity. :)
  113.  
  114. yes it does. works great with any disassembler/debugger/profiler etc.
  115.  
  116. >> BTW (Wouter), is A6 free for our use in E?  Should we be saving and restoring
  117.  
  118. >> A0-A3,A6 .vs. only A0-A3?
  119.  
  120. a6 is free, yes. only a4/a5 must be preserved.
  121. if you use a6 in inline assembly and want it to preserved until after
  122. an E statement, you'll have to save it on the stack too.
  123.  
  124. >> Later.  -- Barry
  125. >>  
  126.  
  127. Wouter
  128.  
  129.    ____  Wouter van Oortmerssen, Wouter@alf.let.uva.nl
  130.   / __/  "Einen Satz verstehen, heisst, wissen was der Fall ist,
  131.  / __/    wenn er wahr ist" - Wittgenstein
  132. /___/  ->subscribe to the E mailing list: amigae-request@bkhouse.cts.com<-